package com.dmz.test.demos.web;



import java.util.List;

/**
 * @author lee
 */
public class FileUtil extends cn.hutool.core.io.FileUtil {

    public static boolean localExist(FtpFile file) {
        List<String> fileNames = listFileNames(file.getLocalPath());
        return fileNames.stream().anyMatch(fileName -> {
            if (file.getEndWith() == null) {
                file.setEndWith("");
            }
            if(fileName.startsWith(file.getFileName()) && fileName.endsWith(file.getEndWith())) {
                file.setFileName(fileName);
                return true;
            }else {
                return false;
            }
        });
    }
}
